/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webServices;

import businessLogic.DataMgr;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import persistence.Medium;
import persistence.MusikCd;
import persistence.SimpleBook;
import persistence.SpecialBook;
import persistence.XxxMovie;

/**
 *
 * @author breinesg
 */
@Stateless
@LocalBean
@WebService(serviceName="OtherService")
/**
 * 
 */
@XmlSeeAlso({SimpleBook.class, MusikCd.class, SpecialBook.class, XxxMovie.class})
public class OtherService {
    @EJB
    private DataMgr dm;
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
    
    public void addBook(String title, String isb, String author) {
        dm.addBook(title, isb, author);
    }
    
   /* public void addSpecialBook(String title, String isb, String author) {
        dm.addSpecialBook(title, isb, author);
    }*/
    
    
    public List<Medium> listMedia() {
        //List<Medium> strList = new ArrayList<Medium>();
        List<Medium> media = dm.getAllMedia();
        return media;
        /*
        for ( Medium med : media ) {
            if ( med instanceof SimpleBook) {
                SimpleBook book = (SimpleBook)med;
                strList.add(book);
            }
        }
        return strList;
        * */
    }
}
